package com.jnmd.service.impl;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jnmd.mapper.VideoMapper;
import com.jnmd.pojo.BatchDelete;
import com.jnmd.pojo.QueryTsc;
import com.jnmd.pojo.Video;
import com.jnmd.service.VideoService;

@Service
public class VideoServiceImpl implements VideoService {

	@Autowired
	private VideoMapper videoMapper;

	@Override
	public List<Video> getAllVideo(QueryTsc queryTsc) {
		
		return videoMapper.getAllVideo(queryTsc);
	}

	@Override
	public void saveVideo(Video video) {
		videoMapper.saveVideo(video);
		
	}

	@Override
	public void updateVideo(Video video) {
		videoMapper.updateVideo(video);
		
	}

	@Override
	public Video findVideoById(int id) {
		
		return videoMapper.findVideoById(id);
	}

	@Override
	public int deleteVideoById(int id) {
	
		return videoMapper.deleteVideoById(id);
	}

	@Override
	public int batchDelete(Integer[] ids) {
		
		BatchDelete bd = new BatchDelete();
		List<Integer> list = Arrays.asList(ids);
		bd.setIds(list);
		return videoMapper.batchDelete(bd);
	}

	@Override
	public int getCountByQueryTsc(QueryTsc queryTsc) {
		
		return videoMapper.getCountByQueryTsc(queryTsc);
	}




}
